<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

use builder\helper\H5;
use yii\helpers\Json;

/* ================= 表单控件模板 ================= */

/** @var \yii\web\View $this View实例 */
/** @var array $controlItems 控件选项 */
/** @var string $requiredStyle 必填项标记风格 */
/** @var string $groupField 当前分组字段 */
?>
<?php foreach ($controlItems as $field => $control): ?>
<?php switch ($control['control']): case 'text': // text ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>

        <!--text:文本-->
        <div class="d-flex align-items-center">
<?php if (isset($control['prefix'])): ?>
            <?= $control['prefix'] ?>
<?php endif; ?>
            <div class="position-relative flex-fill">
                <input id="<?= $control['__id'] ?>"
                    name="<?= $control['__id'] ?>"
                    type="text"
<?php if (!empty($control['maxLength'])): //字符最大长度限制 ?>
                    maxlength="<?= $control['maxLength'] ?>"
                    ng-style="{{ {paddingRight:'45px'} }}"
<?php endif; ?>
                    ng-model="<?= $control['__scope'] ?>"
                    autocomplete="off"
<?php if (!empty($control['datalist'])): ?>
                    list="<?= $control['__id'] ?>_datalist"
<?php endif; ?>
                    style="<?= $control['style'] ?>"
                    placeholder="<?= $control['placeholder'] ?>"
                    title="<?= $control['placeholder'] ?>"
                    class="ym2-form-control layui-input layui-input-sm"<?= $control['attribute'] ?> >
<?php if (!empty($control['maxLength'])): //字符最大长度限制 ?>
                <span class="f12" style="position:absolute;right:4px;top:4px;">
                    <small ng-bind="<?= $control['__scope'] ?>.length"></small>/<?= $control['maxLength'] ?>
                </span>
<?php endif; ?>
<?php if (!empty($control['datalist'])): ?>
                <datalist id="<?= $control['__id'] ?>_datalist">
<?php foreach ($control['datalist'] as $value): ?>
                    <option><?= H5::encode($value) ?></option>
<?php endforeach; ?>
                </datalist>
<?php endif; ?>
            </div>
<?php if (isset($control['suffix'])): ?>
            <?= $control['suffix'] ?>
<?php endif; ?>
        </div>
    </div>
<?php break; case 'datetime': //datetime/date/year/month/time ?>
<?php case 'date': //datetime/date/year/month/time ?>
<?php case 'year': //datetime/date/year/month/time ?>
<?php case 'month': //datetime/date/year/month/time ?>
<?php case 'time': //datetime/date/year/month/time ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <!--datetime/date/year/month/time-->
        <input id="<?= $control['__id'] ?>"
           name="<?= $control['__id'] ?>"
           type="text"
           ng-model="<?= $control['__scope'] ?>"
           ym2-laydate
           ym2-range="<?= $control['range'] ?>"
           ym2-type="<?= $control['control'] ?>"
           style="<?= $control['style'] ?>"
           placeholder="<?= $control['placeholder'] ?>"
           class="ym2-form-control layui-input layui-input-sm"
           title="<?= $control['placeholder'] ?>"
           autocomplete="off"
           readonly="readonly"<?= $control['attribute'] ?>>
    </div>
<?php break; case 'select': // select ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>" style="<?= $control['style'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <!--select/select multiple-->
        <select name="<?= $control['__id'] ?>"
            id="<?= $control['__id'] ?>"
            ng-model="<?= $control['__scope'] ?>"
            ui-select2="<?= H5::encode(Json::encode($control['uiConfig'])) ?>"
            class="ym2-form-control invisible"
            data-placeholder="<?= $control['placeholder'] ?>"
            title="<?= $control['placeholder'] ?>"<?= !empty($control['multiple']) ? ' multiple' : '' ?><?= $control['attribute'] ?>>
<?php if (empty($control['multiple'])): ?>
            <option value=""></option>
<?php endif; ?>
<?php foreach ($control['options'] as $value => $text): ?>
<?php if (is_array($text)): ?>
            <optgroup label="<?= $value ?>">
<?php foreach ($text as $vv => $vTxt): ?>
                <option <?= in_array($vv, $control['disabled']) ? 'disabled' : '' ?> value="<?= $vv ?>">
                    <?= $vTxt ?>
                </option>
<?php endforeach; ?>
            </optgroup>
<?php else: ?>
            <option <?= in_array($value, $control['disabled']) ? 'disabled' : '' ?> value="<?= $value ?>">
                <?= $text ?>
            </option>
<?php endif; ?>
<?php endforeach; ?>
        </select>
    </div>
<?php break; case 'select_link': //select link ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>" style="<?= $control['style'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
<?php if ($control['flag'] == 'START'): // start ?>
        <select ui-select2="<?= H5::encode(Json::encode($control['uiConfig'])) ?>"
                class="invisible"
                id="<?= $control['__id'] ?>"
                name="<?= $control['__id'] ?>"
                ng-change="callSelectLink('<?= $groupField ?>', '<?= $field ?>', <?= H5::encode(Json::encode($control["targetLink"])) ?>, '<?= H5::encode($control["route"]) ?>')"
                ng-model="<?= $control['__scope'] ?>"
                title="<?= $control['placeholder'] ?>"
                data-placeholder="<?= $control['placeholder'] ?>"<?= $control['attribute'] ?>>

            <option value=""><?= $control['placeholder'] ?></option>
            <optgroup ng-if="!<?= $groupField . '__' . $field ?>__options.length"
                      label="{{index}}"
                      ng-repeat="(index, item) in <?= $groupField . '__' . $field ?>__options">
                <option ng-repeat="son in item"
                        value="{{son.value}}"
                        ng-disabled="son.disabled"
                        ng-bind-html="son.text | toHtml">
                </option>
            </optgroup>
            <option ng-if="<?= $groupField . '__' . $field ?>__options.length"
                    ng-repeat="item in <?= $groupField . '__' . $field ?>__options"
                    value="{{item.value}}"
                    ng-disabled="item.disabled"
                    ng-bind-html="item.text | toHtml">
            </option>
        </select>
<?php elseif ($control['flag'] == 'THROUGH'): // through ?>
        <select ui-select2="<?= H5::encode(Json::encode($control['uiConfig'])) ?>"
                class="invisible"
                id="<?= $control['__id'] ?>"
                name="<?= $control['__id'] ?>"
                ng-change="callSelectLink('<?= $groupField ?>', '<?= $field ?>', <?= H5::encode(Json::encode($control["targetLink"])) ?>, '<?= H5::encode($control["route"]) ?>')"
                ng-model="<?= $control['__scope'] ?>"
                title="<?= $control['placeholder'] ?>"
                data-placeholder="<?= $control['placeholder'] ?>"<?= $control['attribute'] ?>>

            <option value=""><?= $control['placeholder'] ?></option>
            <optgroup ng-if="!<?= $groupField . '__' . $field ?>__options.length"
                      label="{{index}}"
                      ng-repeat="(index, item) in <?= $groupField . '__' . $field ?>__options">
                <option ng-repeat="son in item"
                        value="{{son.value}}"
                        ng-disabled="son.disabled"
                        ng-bind-html="son.text | toHtml">
                </option>
            </optgroup>
            <option ng-if="<?= $groupField . '__' . $field ?>__options.length"
                    ng-repeat="item in <?= $groupField . '__' . $field ?>__options"
                    value="{{item.value}}"
                    ng-disabled="item.disabled"
                    ng-bind-html="item.text | toHtml">
            </option>
        </select>
<?php else: // $control['flag'] == 'END' end ?>
        <select ui-select2="<?= H5::encode(Json::encode($control['uiConfig'])) ?>"
                class="invisible"
                id="<?= $control['__id'] ?>"
                name="<?= $control['__id'] ?>"
                ng-model="<?= $control['__scope'] ?>"
                title="<?= $control['placeholder'] ?>"
                data-placeholder="<?= $control['placeholder'] ?>"<?= $control['attribute'] ?>>

            <option value=""><?= $control['placeholder'] ?></option>
            <optgroup ng-if="!<?= $groupField . '__' . $field ?>__options.length"
                      label="{{index}}"
                      ng-repeat="(index, item) in <?= $groupField . '__' . $field ?>__options">
                <option ng-repeat="son in item"
                        value="{{son.value}}"
                        ng-disabled="son.disabled"
                        ng-bind-html="son.text | toHtml">
                </option>
            </optgroup>
            <option ng-if="<?= $groupField . '__' . $field ?>__options.length"
                    ng-repeat="item in <?= $groupField . '__' . $field ?>__options"
                    value="{{item.value}}"
                    ng-disabled="item.disabled"
                    ng-bind-html="item.text | toHtml">
            </option>
        </select>
<?php endif; ?>
    </div>
<?php break; case 'number': //number ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <!--number-->
        <div class="d-flex align-items-center">
<?php if (isset($control['prefix'])): ?>
            <?= $control['prefix'] ?>
<?php endif; ?>
            <input id="<?= $control['__id'] ?>"
                name="<?= $control['__id'] ?>"
                type="number"
                ng-model="<?= $control['__scope'] ?>"
                string-to-number
                autocomplete="off"
<?php if (!empty($control['datalist'])): ?>
                list="<?= $control['__id'] ?>_datalist"
<?php endif; ?>
                style="<?= $control['style'] ?>"
                class="ym2-form-control layui-input layui-input-sm"
                title="<?= $control['placeholder'] ?>"
                placeholder="<?= $control['placeholder'] ?>"<?= $control['attribute'] ?> >
<?php if (!empty($control['datalist'])): ?>
            <datalist id="<?= $control['__id'] ?>_datalist">
<?php foreach ($control['datalist'] as $value): ?>
                <option><?= H5::encode($value) ?></option>
<?php endforeach; ?>
            </datalist>
<?php endif; ?>
<?php if (isset($control['suffix'])): ?>
            <?= $control['suffix'] ?>
<?php endif; ?>
        </div>
    </div>
<?php break; case 'textarea': //textarea ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <div class="position-relative">
            <!--textarea-->
            <textarea name="<?= $control['__id'] ?>"
                      id="<?= $control['__id'] ?>"
<?php if (!empty($control['maxLength'])): //字符最大长度限制 ?>
                      maxlength="<?= $control['maxLength'] ?>"
<?php endif; ?>
                      ng-model="<?= $control['__scope'] ?>"
                      rows="<?= $control['rows'] ?>"
                      class="ym2-form-control layui-textarea"
                      style="<?= $control['style'] ?>"
                      title="<?= $control['placeholder'] ?>"
                      placeholder="<?= $control['placeholder'] ?>"<?= $control['attribute'] ?>></textarea>
<?php if (!empty($control['maxLength'])): //字符最大长度限制 ?>
            <span class="f12" style="position:absolute;right:0;bottom:-26px;">
                <small ng-bind="<?= $control['__scope'] ?>.length"></small>/<?= $control['maxLength'] ?>
            </span>
<?php endif; ?>
        </div>
    </div>
<?php break; case 'checkbox': // checkbox/tag ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>
        <!--checkbox/tag-->
        <div class="layui-form" style="line-height:2;<?= $control['style'] ?>">
<?php foreach ($control['options'] as $value => $text): ?>
            <input type="checkbox"
                   layui-form-render
                   lay-filter="ym2_form_checkbox"
                   ng-model="<?= $control['__scope'] ?>['<?= $value ?>']"
                   ng-true-value="1"
                   ng-false-value="0"
<?php if (!empty($control['disabled']) && in_array($value, $control['disabled'])): ?>
                   disabled="disabled"
<?php endif; ?>
                   name="<?= $control['__id'] ?>[]"
                   title="<?= $text ?>"<?= $control['attribute'] ?>>
<?php endforeach; ?>
        </div>
    </div>
<?php break; case 'switch': //switch ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>

            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>
        <!--checkbox switch-->
        <div class="layui-form" style="<?= $control['style'] ?>">
            <input type="checkbox"
                   layui-form-render
                   lay-filter="ym2_form_switch"
                   name="<?= $control['__id'] ?>"
                   ng-model="<?= $control['__scope'] ?>"
                   ng-true-value="1"
                   ng-false-value="0"
                   title="<?= $control['title'] ?>"
                   lay-skin="switch"<?= $control['attribute'] ?>>
        </div>
    </div>
<?php break; case 'hidden': //hidden ?>
    <!--hidden-->
    <input type="hidden" ng-model="<?= $control['__scope'] ?>">
<?php break; case 'password': //password ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>

        <!--password-->
        <div class="position-relative d-flex align-items-center">
            <input id="<?= $control['__id'] ?>"
               name="<?= $control['__id'] ?>"
               ng-attr-type="{{ <?= $control['__id'] ?>__typetext ? 'text' : 'password' }}"
               ng-model="<?= $control['__scope'] ?>"
               autocomplete="off"
               style="padding-right: 30px;<?= $control['style'] ?>"
               title="<?= $control['placeholder'] ?>"
               placeholder="<?= $control['placeholder'] ?>"
               class="ym2-form-control layui-input layui-input-sm"<?= $control['attribute'] ?>>
            <i ng-click="<?= $control['__id'] ?>__typetext=!<?= $control['__id'] ?>__typetext"
               class="cp d-inline-flex user-select-none bi f16 layui-font-gray"
               ng-class="{'bi-eye': !<?= $control['__id'] ?>__typetext, 'bi-eye-slash': <?= $control['__id'] ?>__typetext}"
               style="position: absolute;right: 8px"></i>
        </div>
    </div>
<?php break; case 'radio': //radio ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>
        <!--radio-->
        <div class="layui-form" style="<?= $control['style'] ?>">
<?php foreach ($control['options'] as $value => $text): ?>
            <input type="radio"
                   layui-form-render
                   lay-filter="ym2_form_radio"
                   ng-model="<?= $control['__scope'] ?>"
                   value="<?= $value ?>"
<?php if (!empty($control['disabled']) && in_array($value, $control['disabled'])): ?>
                   disabled="disabled"
<?php endif; ?>
                   name="<?= $control['__id'] ?>"
                   title="<?= !$control['labelIsHtml'] ? $text : '' ?>"<?= $control['attribute'] ?>>
<?php if ($control['labelIsHtml']): ?>
            <div lay-radio>
                <?= $text ?>
            </div>
<?php endif; ?>
<?php endforeach; ?>
        </div>
    </div>
<?php break; case 'range': //range ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <!--range-->
        <div class="d-flex align-items-center">
            <span ng-mousedown="triggerDecreaseStep('<?= $groupField ?>', '<?= $field ?>', <?= $control["step"] ?>, <?= $control["min"] ?>)"
                  ng-mouseup="cancelStepperTimer()"
                  class="bi bi-dash cursor-pointer border px-1 line-height15"></span>
            <input id="<?= $control['__id'] ?>"
                   name="<?= $control['__id'] ?>"
                   class="form-control-range cursor-pointer"
                   string-to-number
                   min="<?= $control['min'] ?>"
                   max="<?= $control['max'] ?>"
                   step="<?= $control['step'] ?>"
                   title="{{ <?= $control['__scope'] ?> }}"
                   ng-model="<?= $control['__scope'] ?>"
                   type="range"
                   style="<?= $control['style'] ?>"<?= $control['attribute'] ?>>
            <span ng-mousedown="triggerIncreaseStep('<?= $groupField ?>', '<?= $field ?>', <?= $control["step"] ?>, <?= $control["max"] ?>)"
                  ng-mouseup="cancelStepperTimer()"
                  class="bi bi-plus cursor-pointer border px-1 line-height15"></span>
        </div>
        <comment class="layui-font-primary">
            <?= $control['valueLabel'] ?>{{ <?= $control['__scope'] ?> }}<?= $control['valueUnit'] ?>
        </comment>
    </div>
<?php break; case 'static_text': //静态文本 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>
        <!--static text-->
        <div class="py-1" style="<?= $control['style'] ?>"<?= $control['attribute'] ?> ngx-bind-html="$compileHtml( <?= $control['__scope'] ?> )"></div>
    </div>
<?php break; case 'richtext': //富文本(UEditor) ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <!--richtext-->
        <div id="<?= $control['__id'] ?>" ym2-ueditor="<?= H5::encode($control['config']) ?>" style="<?= $control['style'] ?>"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'richtext_tinymce': //富文本(TinyMCE) ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <!--richtext_tinymce-->
        <div style="<?= $control['style'] ?>">
            <textarea id="<?= $control['__id'] ?>" ym2-tinymce="<?= H5::encode($control['config']) ?>"<?= $control['attribute'] ?>><?= $control['initValue'] ?></textarea>
        </div>
    </div>
<?php break; case 'file': //文件上传 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <!--file-->
        <div class="card border-0">
            <div ym2-upload="<?= H5::encode(Json::encode($control['scenario'])) ?>"
                 ym2-style="<?= $control['style'] ?>"
                 ym2-max="<?= $control['max'] ?>"
                 ng-model="<?= $control['__scope'] ?>">
            </div>
        </div>
    </div>
<?php break; case 'section': //控件区间 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <!--section-->
        <div class="input-group">
            <input id="<?= $control['__id'] ?>_begin"
                   type="text"
                   autocomplete="off"
                   ng-model="<?= $control['__scope'] ?>[0]"
                   placeholder="<?= current($control['placeholder']) ?>"
                   title="<?= current($control['placeholder']) ?>"
                   style="<?= $control['firstStyle'] ?>"
                   class="range1 ym2-form-control layui-input w-25 layui-input-sm"<?= $control['firstAttribute'] ?>>
            <span class="layui-font-gray px-2">-</span>
            <input id="<?= $control['__id'] ?>_end"
                   type="text"
                   autocomplete="off"
                   ng-model="<?= $control['__scope'] ?>[1]"
                   placeholder="<?= end($control['placeholder']) ?>"
                   title="<?= end($control['placeholder']) ?>"
                   style="<?= $control['lastStyle'] ?>"
                   class="range2 ym2-form-control layui-input w-25 layui-input-sm"<?= $control['lastAttribute'] ?>>
        </div>
    </div>
<?php break; case 'tag': //动态标签 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <div class="layui-btn-container d-flex align-items-center">
            <!-- active tag-->
            <div class="ym-tag"
                 style="<?= $control['style'] ?>"
                 data-config="<?= $control['config']['remote'] ? H5::encode(Json::encode($control['modal'])) : '' ?>"
                 id="<?= $control['__id'] ?>"
                 lay-filter="<?= $control['__id'] ?>"
                 lay-remote="<?= $control['config']['remote'] ?>"
                 lay-mincount="<?= $control['config']['minCount'] ?>"
                 lay-maxcount="<?= $control['config']['maxCount'] ?>"
                 lay-newTag="<?= $control['config']['allowAdd'] ?>"
                 lay-allowclose="<?= $control['config']['allowClose'] ?>"<?= $control['attribute'] ?>>
<?php if (!empty($control['default']) && is_array($control['default'])): ?>
<?php foreach ($control['default'] as $i => $content): ?>
                <button lay-id="" lay-val="<?= H5::encode($content) ?>" type="button" class="ym-tag-item layui-btn layui-btn-sm">
                    <?= H5::encode($content) ?>
                </button>
<?php endforeach; ?>
<?php endif; ?>
            </div>
        </div>
    </div>
<?php break; case 'trigger': //触发器 ?>
    <div class="<?= $control['class'] ?>" style="<?= $control['style'] ?>"<?= $control['attribute'] ?><?= !empty($control['display']) ? " ng-show=\"{$control['__scope']}\"" : " ng-hide=\"{$control['__scope']}\"" ?>>

    <?= $this->renderPhpFile(__FILE__, ['controlItems' => $control['triggerItems'], 'requiredStyle' => $requiredStyle, 'groupField' => $groupField]) ?>

    </div>
<?php break; case 'value_link': //值连接 ?>
    <?= $this->renderPhpFile(__FILE__, ['controlItems' => $control['sourceControl'], 'requiredStyle' => $requiredStyle, 'groupField' => $groupField]) ?>
<?php break; case 'dynamic_select': //动态下拉 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>" style="<?= $control['style'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>
        <div class="input-group">
<?php if (!empty($control['btnPosition']['left'])): ?>
            <div class="input-group-prepend">
                <div class="layui-btn-group">
<?php foreach ($control['btnPosition']['left'] as $value): ?>
<?php switch ($value): case 'refreshBtn': //刷新 ?>
                    <!--刷新-->
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" title="刷新选项" ng-click="actionDynamicSelectRefresh('<?= $control["__id"] ?>')">
                        <i class="bi bi-arrow-clockwise f15"></i>
                    </button>
<?php break; case 'additionBtn': //新增 ?>
                    <!--新增-->
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-theme" title="新增选项" ng-click="actionDynamicSelectAdd('<?= $control["__id"] ?>')">
                        <i class="bi bi-plus-circle f15"></i>
                    </button>
<?php break; endswitch; ?>
<?php endforeach; ?>
                </div>
            </div>
<?php endif; ?>
            <!--select-dynamic(xm-select)-->
            <div xm-select="<?= $control['__id'] ?>_options"
                 watch-data="<?= $control['__id'] ?>__item_options"
                 ng-model="<?= $control['__scope'] ?>"
                 class="flex-fill"
                 id="<?= $control['__id'] ?>"<?= $control['attribute'] ?>></div>
<?php if (!empty($control['btnPosition']['right'])): ?>
            <div class="input-group-append">
                <div class="layui-btn-group">
<?php foreach ($control['btnPosition']['right'] as $value): ?>
<?php switch ($value): case 'refreshBtn': //刷新 ?>
                        <!--刷新-->
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" title="刷新选项" ng-click="actionDynamicSelectRefresh('<?= $control["__id"] ?>')">
                            <i class="bi bi-arrow-clockwise f15"></i>
                        </button>
<?php break; case 'additionBtn': //新增 ?>
                        <!--新增-->
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-theme" title="新增选项" ng-click="actionDynamicSelectAdd('<?= $control["__id"] ?>')">
                            <i class="bi bi-plus-circle f15"></i>
                        </button>
<?php break; endswitch; ?>
<?php endforeach; ?>
                </div>
            </div>
<?php endif; ?>
        </div>
    </div>
<?php break; case 'dynamic_control': //动态控件 ?>
    <?= $this->renderPhpFile(__DIR__ . '/view.dynamic.control.php', ['controlOptions' => $control, 'requiredStyle' => $requiredStyle, 'groupField' => $groupField]) ?>
<?php break; case 'xselect': //xm-select普通扩展 ?>
<?php case 'xselect_tree': //xm-select下拉树扩展 ?>
<?php case 'xselect_remote': //xm-select远程搜索扩展 ?>
<?php case 'xselect_cascader': //xm-select级联模式 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>

        <!--xm-select-->
        <div xm-select="<?= $control['__id'] ?>_options" ng-model="<?= $control['__scope'] ?>" id="<?= $control['__id'] ?>"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'star': //star 评分 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>

        <!--star-->
        <div id="<?= $control['__id'] ?>"
         ym2-star="<?= $control['__id'] ?>_options"
         style="<?= $control['style'] ?>"
         class="ym2-form-control d-block"
         ng-model="<?= $control['__scope'] ?>"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'select_table': //下拉表格 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
                <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
                <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
            </label>
<?php endif; ?>

        <!--select table-->
        <div id="<?= $control['__id'] ?>"
             ym2-es-select="<?= H5::encode(Json::encode([
                 'groupField' => $groupField,
                 'field' => $field,
                 'nameField' => $control['nameField'],
                 'valueField' => $control['valueField'],
                 'route' => $control['route'],
                 'dynamicParams' => $control['dynamicParams'],
                 'callId' => $control['callId'],
                 'width' => $control['width'],
                 'height' => $control['height'],
                 'title' => $control['title'],
                 'titleCloseBtn' => $control['titleCloseBtn'],
                 'titleMaxminBtn' => $control['titleMaxminBtn'],
                 'repeat' => $control['repeat'],
                 'tipOnRepeat' => $control['tipOnRepeat'],
                 'closeOnSelected' => $control['closeOnSelected'],
                 'refererWindow' => $control['refererWindow'],
             ])) ?>"
             ym2-image-group=""
             on-click-select="actionSelectTable"
             xng-model="<?= $control['__scope'] ?>"
             data-placeholder="<?= $control['placeholder'] ?>"
             style="<?= $control['style'] ?>"
             class="ym2-form-control d-flex flex-wrap"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'transfer': //穿梭框 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>

        <!--穿梭框-->
        <div id="<?= $control['__id'] ?>"
             ngx-transfer="<?= H5::encode(Json::encode($control['_setting'])) ?>"
             dblclick="<?= H5::encode($control['event_dblclick']) ?>"
             style="<?= $control['style'] ?>"
             class="ym2-form-control d-block"
             ng-model="<?= $control['__scope'] ?>"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'colorpicker': //颜色拾取器 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <label class="mb-2 label-color ym2-form-label" for="<?= $control['__id'] ?>">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </label>
<?php endif; ?>

        <!--颜色拾取器-->
        <div id="<?= $control['__id'] ?>"
             ngx-colorpicker="<?= H5::encode(Json::encode($control['_setting'])) ?>"
             changehandler="<?= H5::encode($control['_change_handler']) ?>"
             cancelhandler="<?= H5::encode($control['_cancel_handler']) ?>"
             closehandler="<?= H5::encode($control['_close_handler']) ?>"
             style="box-sizing:content-box;<?= $control['style'] ?>"
             class="ym2-form-control d-block"
             ng-model="<?= $control['__scope'] ?>"<?= $control['attribute'] ?>></div>
    </div>
<?php break; case 'select_layui': //layui下拉控件 ?>
    <div class="form-group col-md-<?= $control['layout'] ?> <?= $control['class'] ?>">
<?php if (!is_null($control['label'])): ?>
        <span class="mb-2 label-color ym2-form-label inline-block">
<?php if (!empty($control['required']) && $requiredStyle == 'mark'): ?>
            <sup>*</sup>
<?php endif; ?>
            <?= $control['label'] ?>
<?php if (!empty($control['help'])): ?>
            <!--帮助-->
            <i style="cursor: help;"
               class="layui-icon layui-icon-tips layui-font-gray f14"
               data-toggle="popover"
               data-trigger="hover"
               data-custom-class="f13 white-space-pre-wrap pointer-event-none"
               data-html="true"
               data-content="<?= H5::encode($control['help']) ?>"
               ym2-bootstrap-plugin="popover"></i>
<?php endif; ?>

<?php if (empty($control['required']) && $requiredStyle == 'text'): ?>
            <span class="layui-font-gray f12">[ 选填 ]</span>
<?php endif; ?>
            <comment class="text-comment pl-1 f12"><?= $control['comment'] ?></comment>
        </span>
<?php endif; ?>
            <!--layui下拉控件-->
        <div class="layui-form" style="<?= $control['style'] ?>">
            <select ngx-layuiform="select" lay-filter="<?= $control['__id'] ?>" ng-model="<?= $control['__scope'] ?>" name="<?= $control['__id'] ?>"<?= $control['attribute'] ?>>
                <option value=""><?= $control['placeholder'] ?></option>
<?php foreach ($control['options'] as $item): ?>
                <option value="<?= $item['value'] ?>"<?= !empty($item['disabled']) ? ' disabled' : '' ?>><?= $item['label'] ?></option>
<?php endforeach; ?>
            </select>
        </div>
    </div>
<?php break; endswitch; ?>
<?php endforeach; ?>
